import axios from 'axios';

const service = axios.create({
    //process.env.NODE_ENV === 'development', //来判断是否开发环境
    // easy-mock服务挂了，暂时不使用了
    baseURL: 'http://127.0.0.1:8096',
    //baseURL: '127.0.0.1:8089',
    timeout: 60000
});

service.interceptors.request.use(
    config => {
        config.headers['token'] = localStorage.getItem("token")==null?null:localStorage.getItem("token");
        config.headers['role_id'] = localStorage.getItem("role_id")==null?null:localStorage.getItem("role_id");
        return config;
    },
    error => {
        console.log(error);
        return Promise.reject();
    }
);

service.interceptors.response.use(
    response => {
        return response;
    },error => {
        console.log(error);
        return Promise.reject();
    }
);

export default service;

